import 'package:flutter/material.dart';
import 'package:flowerny/model/good.dart';

class GoodItem extends StatelessWidget{
  final  Good _good;
  GoodItem(this._good);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(0.1),
      child: SizedBox(
        child: Card(
          elevation: 0.0,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Expanded(child: Image.network(_good.product_icon,fit: BoxFit.cover,),),
              Container(
                alignment: Alignment.centerLeft,
                margin: const EdgeInsets.only(top: 10.0,bottom: 5.0),
                padding: const EdgeInsets.only(left: 4.0,right: 4.0),
                child: Text(
                  _good.product_name,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                  style: TextStyle(
                    fontSize: 12.0,
                    color: Colors.black26,
                  ),
                ),
              ),
              Container(
                padding: const EdgeInsets.only(left: 5.0,right: 5.0),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text(
                      "${_good.product_price}积分",
                      style: TextStyle(
                        fontSize: 14.0,
                        color: Colors.black87,
                      ),
                    ),
                    Text(
                      "已售${_good.sale_count}份",
                      style: TextStyle(
                        fontSize: 13.0,
                        color: Colors.redAccent[100],
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}